with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3))
data <- read.csv("~/Desktop/Workbook1.csv")
with(data, plot(x = Temperature, y = Coeff, type = "b", col = "darkblue", lwd = 3))
data <- read.csv("~/Desktop/Workbook1.csv")
with(data, plot(x = Temperature, y = Coeff, type = "S", col = "darkblue", lwd = 3))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3))
data[1,]
names(data)
colnames(data)
colnames(data)[7] <- "-95CI"
data <- read.csv("~/Desktop/Workbook1.csv")
colnames(data)[7] <- "-95CI"
colnames(data)[8] <- "+95CI"
View(data)
with(data, points(x = Temperature, y = -95CI))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3))
with(data, points(x = Temperature, y = -95CI))
data <- read.csv("~/Desktop/Workbook1.csv")
colnames(data)[7] <- "lower95CI"
colnames(data)[8] <- "upper95CI"
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3))
with(data, points(x = Temperature, y = lower95CI))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3))
with(data, lines(x = Temperature, y = lower95CI, lty = 2))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 4, col = "darkgrey", lwd = 2))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 1, col = "darkgrey", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 1, col = "darkgrey", lwd = 2))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3, ylim = r(-5, 250)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 1, col = "darkgrey", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 1, col = "darkgrey", lwd = 2))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3, ylim = c(-5, 250)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 1, col = "darkgrey", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 1, col = "darkgrey", lwd = 2))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3, ylim = c(-5, 150)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 1, col = "darkgrey", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 1, col = "darkgrey", lwd = 2))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3, ylim = c(-5, 50)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 1, col = "darkgrey", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 1, col = "darkgrey", lwd = 2))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3, ylim = c(-5, 50)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "darkgrey", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "darkgrey", lwd = 2))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3, ylim = c(-5, 50)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "darkgrey", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "darkgrey", lwd = 1))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3, ylim = c(-5, 50)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 1))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3, ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 1))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3, ylim = c(-15, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 1))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3, ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 1))
abline(h = 0, col= "black", lwd = 1)
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3, ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 1))
abline(h = 0, col= "black", lty = 3, lwd = 0.5)
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 3, ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 1))
abline(h = 0, col= "black", lty = 3, lwd = 0.8)
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4, ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 1))
abline(h = 0, col= "black", lty = 3, lwd = 1)
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4, ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "purple", lwd = 4,
xlab = "1 Degree Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
main = "", ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("bottom", c("Monthly death per 100,000", "-95% CI", "+ 95%CI"), col = c("purple", "orange", "orange"), type = "l")
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1 Degree Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
main = "", ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("bottom", c("Monthly death per 100,000", "-95% CI", "+ 95%CI"),
col = c("purple", "orange", "orange"))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1 Degree Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
main = "", ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = "l", c("Monthly death per 100,000", "-95% CI", "+ 95%CI"),
col = c("purple", "orange", "orange"))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1 Degree Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
main = "", ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = 1, c("Monthly death per 100,000", "-95% CI", "+ 95%CI"),
col = c("purple", "orange", "orange"))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1 Degree Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
main = "", ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = 1, cex = 0.8, c("Monthly death per 100,000", "-95% CI", "+ 95%CI"),
col = c("purple", "orange", "orange"))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1 Degree Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
main = "", ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,3,3), cex = 0.8, c("Monthly death rate per 100,000", "-95% CI", "+ 95%CI"),
col = c("darkblue", "orange", "orange"))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1 Degree Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
main = "", ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,3,3), bty = "n", c("Monthly death rate per 100,000", "-95% CI", "+ 95%CI"),
col = c("darkblue", "orange", "orange"))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1 Degree Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
main = "", ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,3,3), lwd = c(3,2,2), bty = "n", c("Monthly death rate per 100,000", "-95% CI", "+ 95%CI"),
col = c("darkblue", "orange", "orange"))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
main = "", ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,3,3), lwd = c(3,2,2), bty = "n", c("Monthly death rate per 100,000", "-95% CI", "+ 95%CI"),
col = c("darkblue", "orange", "orange"))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
main = "Estimated Relationship Between Monthly All-Age Mortality Rate Per 100,000 and Average Monthly Temperature"
sub = "Relative to a day in the 14°-15°C bin", ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,3,3), lwd = c(3,2,2), bty = "n", c("Monthly death rate per 100,000", "-95% CI", "+ 95%CI"),
col = c("darkblue", "orange", "orange"))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
main = "Estimated Relationship Between Monthly All-Age Mortality Rate Per 100,000 and Average Monthly Temperature",
sub = "Relative to a day in the 14°-15°C bin", ylim = c(-10, 30)))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,3,3), lwd = c(3,2,2), bty = "n", c("Monthly death rate per 100,000", "-95% CI", "+ 95%CI"),
col = c("darkblue", "orange", "orange"))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated Relationship Between Monthly All-Age Mortality Rate Per 100,000 and Average Monthly Temperature",
cex = 0.8, font = 3), sub = "Relative to a day in the 14°-15°C bin")
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,3,3), lwd = c(3,2,2), bty = "n", c("Monthly death rate per 100,000", "-95% CI", "+ 95%CI"),
col = c("darkblue", "orange", "orange"))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated Relationship Between Monthly All-Age Mortality Rate Per 100,000 and Average Monthly Temperature \n Relative to a day in the 14°-15°C bin",
cex = 0.8, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,3,3), lwd = c(3,2,2), bty = "n", c("Monthly death rate per 100,000", "-95% CI", "+ 95%CI"),
col = c("darkblue", "orange", "orange"))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated Relationship Between Monthly All-Age Mortality Rate Per 100,000 and Average Monthly Temperature \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,3,3), lwd = c(3,2,2), bty = "n", c("Monthly death rate per 100,000", "-95% CI", "+ 95%CI"),
col = c("darkblue", "orange", "orange"))
data <- read.csv("~/Desktop/Workbook1.csv")
colnames(data)[7] <- "lower95CI"
colnames(data)[8] <- "upper95CI"
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated relationship between monthly all-age mortality rate (per 100,000) and average monthly temperature \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,3,3), lwd = c(3,2,2), bty = "n", c("Monthly death rate per 100,000", "-95% CI", "+ 95%CI"),
col = c("darkblue", "orange", "orange"))
data <- read.csv("~/Desktop/Workbook1.csv")
colnames(data)[7] <- "lower95CI"
colnames(data)[8] <- "upper95CI"
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in each monthly mean temperature (°C) bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,3,3), lwd = c(3,2,2), bty = "n", c("Monthly death rate per 100,000", "-95% CI", "+ 95%CI"),
col = c("darkblue", "orange", "orange"))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,3,3), lwd = c(3,2,2), bty = "n", c("Monthly death rate per 100,000", "-95% CI", "+ 95%CI"),
col = c("darkblue", "orange", "orange"))
data <- read.csv("~/Desktop/Workbook1.csv")
colnames(data)[7] <- "lower95CI"
colnames(data)[8] <- "upper95CI"
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,3,3), lwd = c(3,2,2), bty = "n", c("Monthly death rate per 100,000", "- 95% CI", "+ 95%CI"),
col = c("darkblue", "orange", "orange"))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col = "grey30", border = NA))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col = "lightorange", border = NA))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col=rgb(1, 0, 0,0.5), border = NA))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
adjustcolor("orange",alpha.f=0.5), border = NA))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
adjustcolor("orange",alpha.f=0.8), border = NA))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col=rgb(2, 0, 0,0.5), border = NA))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col=rgb(0.5, 0, 0,0.5), border = NA))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col=rgb(0.5, 0.1, 0,0.5), border = NA))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col=rgb(0.5, 2, 0,0.5), border = NA))
with(data, plot(x = Temperature, y = Coeff, type = "s", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col=rgb(1, 0, 0, 0.3), border = NA))
with(data, plot(x = Temperature, y = Coeff, type = "l", col = "darkblue", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
#with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
#with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col=rgb(1, 0, 0, 0.3), border = NA))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,3,3), lwd = c(3,2,2), bty = "n", c("Monthly death rate per 100,000", "- 95% CI", "+ 95%CI"),
col = c("darkblue", "orange", "orange"))
data <- read.csv("~/Desktop/Workbook1.csv")
colnames(data)[7] <- "lower95CI"
colnames(data)[8] <- "upper95CI"
with(data, plot(x = Temperature, y = Coeff, type = "l", col = "black", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
#with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
#with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col=rgb(1, 0, 0, 0.3), border = NA))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,3,3), lwd = c(3,2,2), bty = "n", c("Monthly death rate per 100,000", "- 95% CI", "+ 95%CI"),
col = c("darkblue", "orange", "orange"))
data <- read.csv("~/Desktop/Workbook1.csv")
colnames(data)[7] <- "lower95CI"
colnames(data)[8] <- "upper95CI"
with(data, plot(x = Temperature, y = Coeff, type = "l", col = "black", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
#with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
#with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col=rgb(1, 0, 0, 0.3), border = NA))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,1), lwd = c(3,2), bty = "n", c("Monthly death rate per 100,000", "- 95% CI", "+ 95%CI"),
col = c("black", "red"))
data <- read.csv("~/Desktop/Workbook1.csv")
colnames(data)[7] <- "lower95CI"
colnames(data)[8] <- "upper95CI"
with(data, plot(x = Temperature, y = Coeff, type = "l", col = "black", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 30)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
#with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
#with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col=rgb(1, 0, 0, 0.3), border = NA))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,1), lwd = c(3,3), bty = "n", c("Monthly death rate per 100,000", "95% CI"),
col = c("black", "red"))
data <- read.csv("~/Desktop/Workbook1.csv")
colnames(data)[7] <- "lower95CI"
colnames(data)[8] <- "upper95CI"
with(data, plot(x = Temperature, y = Coeff, type = "l", col = "black", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 60)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
#with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
#with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col=rgb(1, 0, 0, 0.3), border = NA))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,1), lwd = c(3,3), bty = "n", c("Monthly death rate per 100,000", "95% CI"),
col = c("black", "red"))
data <- read.csv("~/Desktop/Workbook1.csv")
colnames(data)[7] <- "lower95CI"
colnames(data)[8] <- "upper95CI"
with(data, plot(x = Temperature, y = Coeff, type = "l", col = "black", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 150)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
#with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
#with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col=rgb(1, 0, 0, 0.3), border = NA))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,1), lwd = c(3,3), bty = "n", c("Monthly death rate per 100,000", "95% CI"),
col = c("black", "red"))
data <- read.csv("~/Desktop/Workbook1.csv")
colnames(data)[7] <- "lower95CI"
colnames(data)[8] <- "upper95CI"
with(data, plot(x = Temperature, y = Coeff, type = "l", col = "black", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 50)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
#with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
#with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col=rgb(1, 0, 0, 0.3), border = NA))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,1), lwd = c(3,3), bty = "n", c("Monthly death rate per 100,000", "95% CI"),
col = c("black", "red"))
data <- read.csv("~/Desktop/Workbook1.csv")
colnames(data)[7] <- "lower95CI"
colnames(data)[8] <- "upper95CI"
with(data, plot(x = Temperature, y = Coeff, type = "l", col = "black", lwd = 4,
xlab = "1°C Temperature Bins (BEST)", ylab = "Estimated Beta Coefficients",
ylim = c(-10, 50)))
title(main = list("Estimated impact of a day in 1°C monthly mean temperature bins on monthly all-age mortality rate (per 100,000) \n Relative to a day in the 14°-15°C bin",
cex = 1, font = 1))
#with(data, lines(x = Temperature, y = lower95CI, type = "s", lty = 2, col = "orange", lwd = 2))
#with(data, lines(x = Temperature, y = upper95CI, type = "s", lty = 2, col = "orange", lwd = 2))
with(data, polygon(c(Temperature, rev(Temperature)), c(upper95CI, rev(lower95CI)),
col=rgb(1, 0, 0, 0.3), border = NA))
abline(h = 0, col= "black", lty = 3, lwd = 1)
legend("topleft", lty = c(1,1), lwd = c(3,3), bty = "n", c("Monthly death rate per 100,000", "95% CI"),
col = c("black", "red"))
View(data)
1.96^2*0.25/0.05^2
sqrt(0.9)
1/sqrt(0.9)
1.5/(1-e^-1)
1.5/(1-exp^-1)
1.5/(1-exp(-1))
sqrt(1.5/(1-exp(-1)))
sqrt(1.5/(2*(1-exp(-1))))
30/(20*(e-1))
30/(20*(exp-1))
install.packages("gdata")
library("gdata", lib.loc="/Library/Frameworks/R.framework/Versions/3.3/Resources/library")
install.packages("SnowballC")
library("SnowballC", lib.loc="/Library/Frameworks/R.framework/Versions/3.3/Resources/library")
q()
########################################################################
################    TEXT ANALYSIS VOX PRESS RELEASE   ##################
########################################################################
# BY: ALICE TIANBO ZHANG (TZ2218)
# UPDATED: 2017/1/4
#### LOAD PACKAGE ####
# packages <- c("tm", "plyr", "ggplot2", "wordCloud", "RColorBrewer", "SnowballC","tm.plugin.webmining","stm")
# install.packages(packages)
library(tm)
library(plyr)
library(ggplot2)
library(wordcloud)
library(RColorBrewer)
library(SnowballC)
library(tm.plugin.webmining)
library(stm)
#### SET DIRECTORY ####
rm(list = ls())
setwd("~/Dropbox/Research_Columbia/Renewables Voting (Urpelainen Zhang)/Data/Final")
# data.path <- "./Raw/Press/johannes_press"
# save.path <- "./Intermediate/4_vox/Press"
#### LOAD DATA ####
full_data <- read.csv("vox_district_year_cleaned.csv", header = T, sep = ",", strip.white = T, stringsAsFactors = F)
full_data <- full_data[complete.cases(full_data$text),]
#### PRE-PROCESS DATA ####
# Remote HTML
full_data$text <- gsub("<.*?>", "", full_data$text)
full_data$text <- gsub("&nbsp", "", full_data$text)
# Removes stopwords, numbers, punctuation, html, and then convert to lower case and stem words
processed <- textProcessor(documents = full_data$text, metadata = full_data, striphtml = TRUE)
# Plot the number of words and documents removed for different thresholds
plotRemoved(processed$documents, lower.thresh = seq(1, 200, by = 100))
# Remove infrequent words (words that do not appear in at least 10 documents were removed)
out <- prepDocuments(processed$documents, processed$vocab, processed$meta, lower.thresh = 10)
# Create file structure for STM package
docs <- out$documents # word indices and associated counts
vocab <- out$vocab # words associated with the word indices
meta <- out$meta # matrix with document covariates
stm_prev <- stm(docs, vocab, K = 20, prevalence = ~ party + s(year),
max.em.its = 75, data = meta, init.type = "Spectral")
stm_selectM <- selectModel(docs, vocab, K = 20, prevalence = ~ party + s(year),
max.em.its = 75, data = meta, runs = 20, seed = 8458159)
plotModels(stm_selectM)
save.image("~/Dropbox/Research_Columbia/Renewables Voting (Urpelainen Zhang)/Analysis/codeR/voxPress_textAnalysis.RData")
